<template>
	<view class="container">
		<scroll-view scroll-y="true" class="list" @scrolltolower="loadMore">
			<view class="list-item" v-for="(item,index) in list" :key="item.order_sn">
				<div class="item-l">
					<div class="item-status">
						<span v-if="item.state == 1" class="check">提现中</span>
						<span v-if="item.state == 2" class="achieve">提现成功</span>
						<span v-if="item.state == 4" class="filed">已驳回</span>
					</div>
					<p class="jiner">提现金额：<span>￥{{item.money}}</span></p>
					<p class="zhanghu" v-if="item.ali_account">{{item.ali_name}}：{{item.ali_account}}</p>
					<p class="zhanghu" v-if="item.bank_card">{{item.bank_name}}：{{item.bank_card}}</p>
				</div>
				<div class="item-r">
					<span class="shijian">{{item.createtime}}</span>
					<p class="shouxu">手续费：<span>0.0</span></p>
				</div>
			</view>
		</scroll-view>
	</view>
</template>

<script>
	import { cashRecord } from '../../../api/api.js'
	export default {
		data() {
			return {
				list: [],
				total: '',
				current_page: 1,
				limit: 30,
				last_page: 0
			}
		},
		onLoad() {
			this.getList()
		},
		methods: {
			getList(loadMore) {
				cashRecord({
					limit: this.limit,
					page: this.current_page
				}).then(res => {
					if(loadMore){
						if(this.current_page <= this.last_page){
							for (let i = 0; i < res.data.data.length; i++) {
								this.list.push(res.data.data[i])
							}
						}else{
							// uni.showToast({
							// 	icon:'none',
							// 	title:'没有更多提现记录了'
							// })
						}
					}else{
						this.list = res.data.data
					}
					this.total = res.data.total
					this.last_page = res.data.last_page
					// this.current_page = res.data.current_page
				})
			},
			loadMore() {
				console.log("加载更多")
				if (this.current_page < this.last_page) {
					this.current_page += 1
					this.getList('loadMore')
				} else {
				
				}
			},
		},
	}
</script>

<style scoped lang="scss">
	.container {
		width: 100%;
		height: 100%;
		background: #F7F7F7;
	}

	.list {
		width: calc(100% - 60upx);
		height: 100%;
		padding: 0 30upx;

		.list-item {
			width: 100%;
			background: #FFFFFF;
			box-shadow: 0px 2px 4px 0px rgba(41,121,255,0.05);
			border-radius: 8px;
			margin: 15px auto;
			padding: 10px;
			display: flex;
			justify-content: space-between;
			.item-l{
				line-height: 26px;
				.item-status{
					.check{
						font-weight: 800;
						font-size: 14px;
						color: #25AB64;
					}
					.achieve{
						font-weight: 800;
						font-size: 14px;
						color: #413100;
					}
					.filed{
						font-weight: 800;
						font-size: 14px;
						color: #F95452;
					}
				}
				.jiner{
					font-weight: 400;
					font-size: 14px;
					color: #666666;
					span{
						color: #F95452;
					}
				}
				.zhanghu{
					width: 200px;
					font-weight: 400;
					font-size: 14px;
					color: #666666;
				}
			}
			.item-r{
				line-height: 26px;
				.shijian{
					font-weight: 400;
					font-size: 14px;
					color: #666666;
				}
				.shouxu{
					font-weight: 400;
					font-size: 14px;
					color: #666666;
					span{
						color: #FF4149
					}
				}
			}
		}
	}
	@media screen and (min-width:800px){
		.list{
			height:calc(100vh - 100upx)!important;
		}
	}
</style>
